UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yPY7mQQZjnITfbWa3fyDRetEr4MBedGPhsHYSYijgso=' 
WHERE 
  key_id = '48973c9867b1996b35d55703b9e1d96722252051850a6b74992579e756248c88' 
  AND (
    token = 'yPY7mQQZjnITfbWa3fyDRetEr4MBedGPhsHYSYijgso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022