UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R6c6SBsZRKlrcZ0AgXJX35AqYGeKc6BPuPaxdGLk9dA=' 
WHERE 
  key_id = 'c91e277b405a9ad05078bfa2175bb74ab7037852facf1c697d8ce031f62aa74e' 
  AND (
    token = 'R6c6SBsZRKlrcZ0AgXJX35AqYGeKc6BPuPaxdGLk9dA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050