UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h/d1a9DwenRNMMede1Zi1gpBnupRAhQfrl0bJIS6Mgg='
WHERE
key_id = 'fed6877c712d5a027abaca8a936e3b32de4fe043ca67411db5fc548db9ff0e26'
AND (
token = 'h/d1a9DwenRNMMede1Zi1gpBnupRAhQfrl0bJIS6Mgg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)