UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gdseFMSGVmjdy6Q9nVEm6q2MiEn4Q3owKrVtEFrhL0A=' 
WHERE 
  key_id = 'd252622deea3544b7bceffa5f6dfc5e29e878bfdde2f46355cd883687b7be0fd' 
  AND (
    token = 'gdseFMSGVmjdy6Q9nVEm6q2MiEn4Q3owKrVtEFrhL0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032