UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5h0qRoQJJAOUdDbaX9emVx2PErpBIj2+b4whcB19WWM='
WHERE
key_id = '6fff029169856f4b4dd12374ebaabf841f2513bbdc1badf8df51cf0ffab504ec'
AND (
token = '5h0qRoQJJAOUdDbaX9emVx2PErpBIj2+b4whcB19WWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)