UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lhvPp81zFf80SNd042YcDvOryIpea/tBy9rabuKkRc0=' 
WHERE 
  key_id = '98450ce34552a3160874708c1392cc4a85d82a63f106084b569219f6f7b5f30a' 
  AND (
    token = 'lhvPp81zFf80SNd042YcDvOryIpea/tBy9rabuKkRc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036