UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A575YdApG/e2k+IzuhNOB0vJqUN9Y7zTJ3EElDDL4Qg='
WHERE
key_id = 'fa7a74da8afb2caba039e2e645ab5c910d1653c1df4aa49b90df6489df54fc50'
AND (
token = 'A575YdApG/e2k+IzuhNOB0vJqUN9Y7zTJ3EElDDL4Qg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)