UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r5ws82wwIAZi/jLQ6fTU0PJAFGIW/oDnfDgQyPkBUvY=' 
WHERE 
  key_id = '77640fed9cb40271d3a8a5723c5d999753624bb59b3cefad793a762704afd71b' 
  AND (
    token = 'r5ws82wwIAZi/jLQ6fTU0PJAFGIW/oDnfDgQyPkBUvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047