UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jn9vUIBBlma2VFjZm1lI82bR1hXtCJtKu9MkOUa6uHA=' 
WHERE 
  key_id = '82e41b61b50989c50fbb22f74884b9d5990c79eb0572a3a81a962af765c8c689' 
  AND (
    token = 'Jn9vUIBBlma2VFjZm1lI82bR1hXtCJtKu9MkOUa6uHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029