UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eZ9KUH2r06ZWreEjxQf30JX7aKU1cbi8GcHbXxMsx9U='
WHERE
key_id = '1d658f3a057708a3e312af8258aa31e45c690dfc7701abe2d3954e3f9ad0519a'
AND (
token = 'eZ9KUH2r06ZWreEjxQf30JX7aKU1cbi8GcHbXxMsx9U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)