UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IDu4PduyCVSlvZJQKk7zLzXjVjG4Fa3+790NwpV9zh8='
WHERE
key_id = 'a3805a510f2f468a5a45cfae0fd8b42159537079eccb16dbca768807f056f969'
AND (
token = 'IDu4PduyCVSlvZJQKk7zLzXjVjG4Fa3+790NwpV9zh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)