UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zOb0B3g0Gvj5R58NN1NLkAXhRK4KOG6vxqOzWOfh6Ww=' 
WHERE 
  key_id = '253f463286816494aeb4bc37669981b4d4606a163f301ca9d2467ee79b8fe920' 
  AND (
    token = 'zOb0B3g0Gvj5R58NN1NLkAXhRK4KOG6vxqOzWOfh6Ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025