UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O5Wzoa5BcC37aAQoI+mbCFFjg8BP2X/nufc7gl3Dxhw='
WHERE
key_id = 'd251d5f9d6a0cea06bbbe467353ba352994881c2b1749150df4f4f1efc8b1479'
AND (
token = 'O5Wzoa5BcC37aAQoI+mbCFFjg8BP2X/nufc7gl3Dxhw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)