UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '77XdfPq/qwLOlcupJX+w2EgiKRJjcv2W5B7WElc868k=' 
WHERE 
  key_id = '663c9d8d91d98f444068339f2d573af8a2c107082006f4fb475b84684d2ba3f6' 
  AND (
    token = '77XdfPq/qwLOlcupJX+w2EgiKRJjcv2W5B7WElc868k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023