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

Query time 0.00052