UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dAQbO3xAY1+j27fTNNYEJamboCf+OTYGMQhYX8dROhU=' 
WHERE 
  key_id = 'e22f2d9ecee84580891d2540f88535c9328e1abe17d81a9ad37418d640dd846f' 
  AND (
    token = 'dAQbO3xAY1+j27fTNNYEJamboCf+OTYGMQhYX8dROhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034