UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I9l3AeJcHyJcpVCJYq3dl8Mb+XdFsjgf3jRTaemKCYo='
WHERE
key_id = 'd7b96f167972390f600664f4728e81b5b02534f840af1e759a2353fa284d5992'
AND (
token = 'I9l3AeJcHyJcpVCJYq3dl8Mb+XdFsjgf3jRTaemKCYo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)