UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i6luvfC6Sp0ifP9/vEPU7f7Yn0M/b7ECWPtBUrrzauE='
WHERE
key_id = '39987336649ae2be8b4d451cafb93cce6d8edd3352ffa7a1c1b5aeed31de50ec'
AND (
token = 'i6luvfC6Sp0ifP9/vEPU7f7Yn0M/b7ECWPtBUrrzauE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)