UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hWEAXYpYONJRGD8rtkz1c+r9fU9AZ/s5sCGkkbOYQ+w='
WHERE
key_id = '5ec732450efff509641ee252b96d55fd95ded76cd7d921f5771cde2738f5f207'
AND (
token = 'hWEAXYpYONJRGD8rtkz1c+r9fU9AZ/s5sCGkkbOYQ+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)