UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hUp52HzTRS0uyhp90ZICwL9diICYH0HcOefHL0Dt/sw='
WHERE
key_id = 'a1130ea4f8252cb984832eeff9b55b8d92f4574a6545b867a575660cb0eaca56'
AND (
token = 'hUp52HzTRS0uyhp90ZICwL9diICYH0HcOefHL0Dt/sw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)