UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FRr4NhUTNf3dwXz620R8JFWveviOgK1aZ6/056kYihk=' 
WHERE 
  key_id = '104ed24f396462c8f5ad202d47af925b8f7d45ccd027848722a5fbcb50f83169' 
  AND (
    token = 'FRr4NhUTNf3dwXz620R8JFWveviOgK1aZ6/056kYihk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042