UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q7OmBkmdt2vJ6gM9l7B03fmD5EF0uaf3CYsK4O5KM0k='
WHERE
key_id = '240bdcadd1ff462f07bb515fe6b1c6fc03b00ad155103b950ce2e886386dc2cf'
AND (
token = 'Q7OmBkmdt2vJ6gM9l7B03fmD5EF0uaf3CYsK4O5KM0k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)