UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WrPPE9TER3qGx0KVkU1QE9psBzJG1lHYym6YhWuzum0=' 
WHERE 
  key_id = '076bcf4f8a17f7d714183c2fafb392253f4c4b10203faddf4fe41fae9f4760c1' 
  AND (
    token = 'WrPPE9TER3qGx0KVkU1QE9psBzJG1lHYym6YhWuzum0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019