UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bbmh6/8uqGYImMisN0zDCBeF0kGZuO8QUdI7HexlKSk=' 
WHERE 
  key_id = '3caf932a46e1b4d697a9414a455807b94e9d1f5e3f3803bb883c90cdcc7d2496' 
  AND (
    token = 'bbmh6/8uqGYImMisN0zDCBeF0kGZuO8QUdI7HexlKSk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026