UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ekN1TG/cgeq0e7gGXA7vzle1BB5MYbBmhLflIX/hBqk='
WHERE
key_id = 'b1082e866317504531ff67a06ecff8c6bf58ecf6eb787d3db579bfc67fa8309c'
AND (
token = 'ekN1TG/cgeq0e7gGXA7vzle1BB5MYbBmhLflIX/hBqk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)