UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QIjcMiyG5CVqP1wKKz1WKiY9ygYDAlKU0g52gNp1tV8=' 
WHERE 
  key_id = '998ada7afe6fea084cfee379f34b33eefcd074601812248210f08d6812372eca' 
  AND (
    token = 'QIjcMiyG5CVqP1wKKz1WKiY9ygYDAlKU0g52gNp1tV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020