UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4kKs9frYAJ5EwYwUGC3G3liahpsXh1OaH34Yax9zLk4=' 
WHERE 
  key_id = 'd3f9e1980701a9e002a6fe1894385d09f6ac82de5366cee61f9d755579d4cb92' 
  AND (
    token = '4kKs9frYAJ5EwYwUGC3G3liahpsXh1OaH34Yax9zLk4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022