UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I3E6aCA6Q9ULyL4OOuNGwJp8LwXEm9400MGX8SftpSU='
WHERE
key_id = 'a683d64a8de7c033213648fbf272086f1f2e0dc368768896b8ad6c5d15f9e2e7'
AND (
token = 'I3E6aCA6Q9ULyL4OOuNGwJp8LwXEm9400MGX8SftpSU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)