UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wb8PtawQNTbINT2eQBcJ+JoN8qrFup1k5gY81a4sXt0=' 
WHERE 
  key_id = '13893b0e8a98ce1f694534a86212000e6b83f0eaa78767442d16ee78ff178f61' 
  AND (
    token = 'wb8PtawQNTbINT2eQBcJ+JoN8qrFup1k5gY81a4sXt0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030