UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OsuWVRjksRiBaeKsCIq+OfBnKBDrFH09whdwNns4+xc=' 
WHERE 
  key_id = 'a99c252770dad695df6026aec8c905e57f4cda405e94b0c3cba3f3c55dcff5b2' 
  AND (
    token = 'OsuWVRjksRiBaeKsCIq+OfBnKBDrFH09whdwNns4+xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025